if(MSVC)

add_custom_target( copy_externals )
add_externals_target( copy_externals )

if( WIN32 )
	if( CMAKE_CL_64 )
		set(TBB_BIN_ROOT "${EXTERNALS_ROOT}/tbb/bin/x64")
	else()  # win32
		set(tbb_bin_root "${EXTERNALS_ROOT}/tbb/bin/x86")
	endif()

	# add_custom_command(
		# TARGET copy_externals
		# PRE_BUILD
		# COMMAND ${CMAKE_COMMAND} -E echo "Copying TBB..."
		# COMMAND ${CMAKE_COMMAND} -E copy "${TBB_BIN_ROOT}/tbbmalloc_debug.dll" "${CMAKE_BINARY_DIR}/Debug/tbbmalloc_debug.dll"
		# COMMAND ${CMAKE_COMMAND} -E copy "${TBB_BIN_ROOT}/tbbmalloc_debug.pdb" "${CMAKE_BINARY_DIR}/Debug/tbbmalloc_debug.pdb"
		# COMMAND ${CMAKE_COMMAND} -E copy "${TBB_BIN_ROOT}/tbbmalloc.dll" "${CMAKE_BINARY_DIR}/Release/tbbmalloc.dll"
		# COMMAND ${CMAKE_COMMAND} -E copy "${TBB_BIN_ROOT}/tbbmalloc.pdb" "${CMAKE_BINARY_DIR}/Release/tbbmalloc.pdb"
		# COMMENT "Copying TBB..."
	# )
	
else( WIN32 )

endif( WIN32 )

endif(MSVC)